package com.bwie.parkdemo.adapter;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

import com.bwie.parkdemo.R;
import com.bwie.parkdemo.mvvm.model.entity.RepairEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * 维修列表适配器
 * */
public class RepairAdapter extends BaseQuickAdapter<Object,BaseViewHolder>{

    public static int type = 6;

    public RepairAdapter() {
        super(R.layout.item_repair);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Object item) {
        RepairEntity.Values values = (RepairEntity.Values) item;
        helper.setText(R.id.repair_item_title_tv,values.repairDescribe);
        helper.setText(R.id.repair_item_address_tv,values.repairData);
        ImageView img = helper.getView(R.id.repair_item_sel_img);
        if (values.isShow)
            img.setVisibility(View.VISIBLE);
        else
            img.setVisibility(View.GONE);
        if (values.isSelect)
            img.setImageResource(R.drawable.gou);
        else
            img.setImageResource(R.drawable.gou_default);
        helper.addOnClickListener(R.id.repair_item_sel_img);
    }
}
